<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <Count v-for="item in 6" :key="item"></Count>
        <Big></Big>
    </div>

    <script>
        const h = Vue.extend({
            template:`<h2>wo shi zhongguoren </h2>`,
        });
        console.log(h);
        const Count = Vue.extend({
            components:{
                Hh:h
            },
            data() {
                return {
                    n: 1
                };
            },
            template: `
            <div>
                <Hh></Hh>
                <button @click="minus">-</button>
            <span>{{n}}</span>
            <button @click="add">+</button>
            </div>
            `,
            methods: {
                minus() {
                    this.n--;
                },
                add() {
                    this.n++
                }
            },
        });

        const Big = Vue.extend({
            template:`
            <div :style="{fontSize:size+'px'}" @click="change">哈哈哈啊</div>
            `,
            data(){
                return {
                    size:16,
                }
            },
            methods: {
                change(){
                    this.size += 10
                }
            },
        });
        const VM = new Vue({
            el: '#app',
            components: {
                Count,
                Big
            }
        });
    </script>
</body>

</html>